FROM maven:3.8.1-jdk-8-slim as builder

# Copy local code to the container image.
WORKDIR /workspace/app
# 将Maven的设置文件复制到容器中
COPY mvnw .
COPY .mvn .mvn
COPY pom.xml .
COPY src ./src

# Build a release artifact.
RUN mvn package -DskipTests

# Run the web service on container startup.
FROM openjdk:8-jdk-slim
VOLUME /tmp
COPY --from=build /workspace/app/target/*.jar app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]